package com.itheima.day06;

import java.util.*;

public class Demo5 {
    public static void main(String[] args) {
        Map<String, List<String>> datas=new HashMap<>();

        List<String> selects1=new ArrayList<>();
        Collections.addAll(selects1,"A","B","C");
        datas.put("zs",selects1);

        List<String> selects2=new ArrayList<>();
        Collections.addAll(selects2,"B","C");
        datas.put("mm",selects2);

        List<String> selects3=new ArrayList<>();
        Collections.addAll(selects3,"C","D");
        datas.put("gg",selects3);

        System.out.println(datas);

        Collection<List<String>> values = datas.values();
        Map<String,Integer> num=new HashMap<>();
        for (List<String> value : values) {
            for (String s : value) {
                if (num.containsKey(s)) {
                    num.put(s, num.get(s)+1);
                }else {
                    num.put(s,1);
                }
            }
        }
        System.out.println(num);
    }
}
